105A - Transmigration - CodeForces Solution


implementation *1700

Please click on ads to support us..

C++ Code:

#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

int main(){

    const int minLevel(100);
    const double eps = 0.001;

    int n, m; double k; std::cin >> n >> m >> k;

    std::map<std::string, int> skillMap;
    for(int p = 0; p < n; p++){
        std::string currentSkill; int currentLevel;
        std::cin >> currentSkill >> currentLevel;
        if(k * currentLevel >= minLevel){skillMap.insert(std::pair<std::string, long>(currentSkill, eps + k * currentLevel));}
    }
    for(int p = 0; p < m; p++){
        std::string currentSkill; std::cin >> currentSkill;
        if(skillMap.find(currentSkill) == skillMap.end()){skillMap.insert(std::pair<std::string, long>(currentSkill, 0));}
    }

    std::vector<std::string> skillVec;
    std::map<std::string, int>::iterator mapIter;
    for(mapIter = skillMap.begin(); mapIter != skillMap.end(); mapIter++){skillVec.push_back(mapIter -> first);}
    sort(skillVec.begin(), skillVec.end());

    std::cout << skillVec.size() << std::endl;
    for(int p = 0; p < skillVec.size(); p++){std::cout << skillVec[p] << " " << skillMap[skillVec[p]] << std::endl;}


    return 0;
}


Comments

Submit
0 Comments
More Questions

1667B - Optimal Partition
1668B - Social Distance
88B - Keyboard
580B - Kefa and Company
960A - Check the string
1220A - Cards
897A - Scarborough Fair
1433B - Yet Another Bookshelf
1283B - Candies Division
1451B - Non-Substring Subsequence
1408B - Arrays Sum
1430A - Number of Apartments
1475A - Odd Divisor
1454B - Unique Bid Auction
978C - Letters
501B - Misha and Changing Handles
1496A - Split it
1666L - Labyrinth
1294B - Collecting Packages
1642B - Power Walking
1424M - Ancient Language
600C - Make Palindrome
1669D - Colorful Stamp
1669B - Triple
1669A - Division
1669H - Maximal AND
1669E - 2-Letter Strings
483A - Counterexample
3C - Tic-tac-toe
1669F - Eating Candies